; Load the loader.
; Get memory and disk information.

; Where the loader is loaded.
BASE_LOADER	equ	09000h

; The loader on image, in sector.
IMG_BEGIN_LOADER	equ	1
IMG_LEN_LOADER		equ	3

; This is an old and magical number!
Offset	equ	07c00h

	org	Offset
	mov	ax, cs
	mov	ds, ax
	mov	es, ax
	mov	ss, ax
	mov	sp, Offset

	; display "boot..."
	mov	ah, 3
	mov	bh, 0
	int	10h
	mov	ax, LoadMes
	mov	bp, ax
	mov	cx, 28
	mov	ax, 01301h
	mov	bx, 0007h
	int	10h

	; load the loader
	mov	ax, BASE_LOADER
	mov	es, ax
	mov	bx, 0
	mov	ax, IMG_BEGIN_LOADER

	mov	cl, 18
	div	cl
	mov	cl, ah
	inc	cl
	mov	ch, al
	shr	ch, 1
	mov	dh, al
	and	dh, 1
	mov	dl, 0	; 0 - floppya, 80h - disk
	mov	ah, 2
	mov	al, IMG_LEN_LOADER
	int	13h

	jmp	BASE_LOADER:0

LoadMes		db	"Welcome to Pigos. Booting..."
times	510-($-$$)	db 0
dw	0xaa55
